package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.Sku;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

public interface SkuMapper extends BaseMapper<Sku> {

    /**
     * 根据传进来的sku的数据信息，减少库存  增加销量
     * @param sku
     * @return
     */
    @Update("update tb_sku set stock = stock - #{num},sold = sold + #{num} where id = #{id}")
    int deductStock(Map<String,Object> sku);

}
